package com.scienview.core.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.stereotype.Component;

@Component
public class SpringBeanFactory implements BeanFactoryAware {

	private static  BeanFactory beanFactory;
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		SpringBeanFactory.beanFactory=beanFactory;
		
	}

	
	public static <T>T getBean(Class<T> t){
		return (T)beanFactory.getBean(t);
	}
	
	public static BeanFactory getBeanFactory(){
		return SpringBeanFactory.beanFactory;
	}
	
}
